package com.bonuo.crm.service.impl;

import com.bonuo.crm.domain.Process;
import com.bonuo.crm.mapper.ActivityMapper;
import com.bonuo.crm.mapper.ProcessMapper;
import com.bonuo.crm.service.ProcessService;
import com.ruoyi.common.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProcessServiceImpl implements ProcessService {
    @Autowired
    private ProcessMapper processMapper;
    @Override
//    @DataScope(provinceAlias = {"cli"})
    public List<Process> selectProcessList(Process process) {
        return processMapper.selectProcessList(process);
    }

    @Override
    public Integer insertProcess(Process process) {
        //先查看下对应项目的进度是否存在
        Integer check = processMapper.selectProcessByProjectFundIdAndSchedule(process);
        if(check>0){
            //返回1 表示进度存在
            return 1;
        }
        return processMapper.insertProcess(process);
    }

    @Override
    public Integer updateProcess(Process process) {
        return processMapper.updateProcess(process);
    }

    @Override
    public Integer deleteProcessById(Integer id) {
        return processMapper.deleteProcessById(id);
    }

    @Override
    public Integer selectProcessByProjectFundId(Integer id) {
        return processMapper.selectProcessByProjectFundId(id);
    }
}
